package com.luomo.wenyuan.modules.wenyuan.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.luomo.wenyuan.common.utils.PageUtils;
import com.luomo.wenyuan.common.utils.Query;
import com.luomo.wenyuan.modules.wenyuan.dao.TPurchaseApplicationDao;
import com.luomo.wenyuan.modules.wenyuan.entity.TPurchaseApplicationEntity;
import com.luomo.wenyuan.modules.wenyuan.service.TPurchaseApplicationService;
import org.springframework.stereotype.Service;

import java.util.Map;


@Service("tPurchaseApplicationService")
public class TPurchaseApplicationServiceImpl extends ServiceImpl<TPurchaseApplicationDao, TPurchaseApplicationEntity> implements TPurchaseApplicationService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Integer status = Integer.valueOf((String) params.get("status"));
        IPage<TPurchaseApplicationEntity> page = this.page(
                new Query<TPurchaseApplicationEntity>().getPage(params),
                new QueryWrapper<TPurchaseApplicationEntity>()
                        .eq(status != null, "status", status)
        );

        return new PageUtils(page);
    }

}